import request from '@/utils/request'

export function getUserPostList(params) {
  return request({
    url: '/api/userPost/list',
    method: 'get',
    params
  })
}

export function getUserPost(id) {
  return request({
    url: `/api/userPost/${id}`,
    method: 'get'
  })
}

export function createUserPost(data) {
  return request({
    url: '/api/userPost',
    method: 'post',
    data
  })
}

export function updateUserPost(id, data) {
  return request({
    url: `/api/userPost/${id}`,
    method: 'put',
    data
  })
}

export function deleteUserPost(id) {
  return request({
    url: `/api/userPost/${id}`,
    method: 'delete'
  })
}

export function likeUserPost(id, data) {
  return request({
    url: `/api/userPost/${id}/like`,
    method: 'post',
    data
  })
}

export function unlikeUserPost(id, data) {
  return request({
    url: `/api/userPost/${id}/unlike`,
    method: 'post',
    data
  })
}

export function getUserPosts(user_id, params) {
  return request({
    url: `/api/userPost/user/${user_id}`,
    method: 'get',
    params
  })
} 